//---------------------------------------------------------------------------

#ifndef TEnumMemberH
#define TEnumMemberH

#include <ComCtrls.hpp>
#include <vector.h>

//---------------------------------------------------------------------------
//template <class T>

enum eLanguage {lChinese = 0, lEnglish};

class TEnumMember
{
public:
	int Index;
	AnsiString ChineseName;
	AnsiString EnglishName;
	eLanguage Language;
	AnsiString __fastcall GetName(void)
	{
		switch (Language) {
			case lChinese: return ChineseName;break;
			case lEnglish: return EnglishName;break;
		}
	}
	bool Active;
};

template <class T>
class TEnumList : public vector<T>
{
public:
	T __fastcall Which(const AnsiString Name)
	{
		for (int i = 0; i < size(); i++) {
			if (at(i).ChineseName == Name) {
				return at(i);
			}
		}
	}
	T __fastcall Which(const int Index)
	{
		for (int i = 0; i < size(); i++) {
			if (at(i).Index == Index) {
                return at(i);
			}
		}
    }
	AnsiString __fastcall Name(const int Index)
	{
		for (int i = 0; i < size(); i++) {
			if (at(i).Index == Index) {
				return at(i).ChineseName;
			}
		}
	}
	int __fastcall Index(const AnsiString Name)
	{
		for (int i = 0; i < size(); i++) {
			if (at(i).ChineseName == Name) {
                return at(i).Index;
			}
		}
    }
};

class TEnumMemberList : public TEnumList<TEnumMember>
{

};

/*
class TEnumMemberList : public vector<TEnumMember>
{
public:
//	__fastcall TEnumMemberList();
   TEnumMember __fastcall Which(const AnsiString Name);
   TEnumMember __fastcall Which(const int Index);
   int __fastcall Index(const AnsiString Name);
   AnsiString __fastcall Name(const int Index);
};*/



#endif
